<!-- 测评任务详细信息-->
<template>
  <a-card :bordered="false" class="card-area">


    <!-- 搜索区域 -->
    <a-form layout="horizontal">
      <a-row>
        <a-col :md="24" :sm="24">
          <a-form-item label="任务名称" :labelCol="{ span: 4 }" :wrapperCol="{ span: 18, offset: 2 }">
            <a-input v-model="checkDetailInfo.name" />
          </a-form-item>
        </a-col>       
      </a-row>
      <a-row>      
        <a-col :md="24" :sm="24">
          <a-form-item label="包含量表" :labelCol="{ span: 4 }" :wrapperCol="{ span: 18, offset: 2 }">
            <a-input v-model="checkDetailInfo.tableName" />
          </a-form-item>
        </a-col>
      </a-row>
      <a-row>      
        <a-col :md="24" :sm="24">
          <a-form-item label="测评人数" :labelCol="{ span: 4 }" :wrapperCol="{ span: 18, offset: 2 }">
            <a-input v-model="checkDetailInfo.userNum" />
          </a-form-item>
        </a-col>
      </a-row>

      <a-row>
        <a-col :md="24" :sm="24">
          <a-form-item label="测评人员列表">
          </a-form-item>
        </a-col>
      </a-row>

    </a-form>


    <!-- 表格区域 -->
    <a-table ref="TableInfo" :columns="columns" :rowKey="record => record.id" :dataSource="checkDetailInfo.userList"
      :loading="loading" :scroll="{ x: 900 }">
    </a-table>

    <!-- 量表问题选项查看 -->
    <question-detail :detailData="detail.data" :detailVisiable="detail.visiable" @close="handleClose">
    </question-detail>

  </a-card>
</template>

<script>
import QuestionDetail from './QuestionDetail'
import RangeDate from '@/components/datetime/RangeDate'

export default {
  name: 'CheckTaskDetail',
  components: { RangeDate, QuestionDetail },
  data() {
    return {
      detail: {
        visiable: false,
        data: {}
      },
      checkDetailInfo: {},
      loading: false,
      pagination: {
        pageSizeOptions: ['10', '20', '30', '40', '100'],
        defaultCurrent: 1,
        defaultPageSize: 10,
        showQuickJumper: true,
        showSizeChanger: true,
        showTotal: (total, range) => `显示 ${range[0]} ~ ${range[1]} 条记录，共 ${total} 条记录`
      }
    }
  },
  computed: {
    columns() {
      return [{
        title: 'uuid',
        dataIndex: 'uuid'
      }, {
        title: '用户头像',
        dataIndex: 'question',
        scopedSlots: { customRender: 'question' }
      }, {
        title: '微信昵称',
        dataIndex: 'titleOne'
      }, {
        title: '用户名',
        dataIndex: 'titleTwo'
      }, {
        title: '真实姓名',
        dataIndex: 'createTime'
      }, {
        title: '组织机构',
        dataIndex: 'operation'
      }]
    }
  },
  mounted() {
    this.fetch()
  },
  methods: {

    view(record) {
      this.detail.data = record
      this.detail.visiable = true
    },

    handleClose() {
      this.detail.visiable = false
    },

    reset() {
      // 清空部门树选择
      this.$refs.deptTree.reset()
      this.fetch()
    },

    fetch() {
      this.loading = true
      this.$get('CheckTask/view/' + this.$route.params.id).then((r) => {
        this.checkDetailInfo = r.data.data
        this.loading = false
      })
    }
  }
}
</script>
<style lang="less" scoped>
@import "../../../static/less/Common";
</style>
